<?php
//通过参数形式连接数据库
try{
	$dsn = 'mysql:host=localhost;dbname=test';
	$username = 'root';
	$password = '123456';
	$pdocon = new PDO($dsn,$username,$password);
	var_dump($pdocon);
	
	$sql = "select * from users";
	$stmt = $pdocon->query($sql);
	var_dump($stmt);
	foreach($stmt as $row) {
		print_r($row);
		echo '<br/>';
	}
	
} catch(PDOException $e) {
	echo $e->getMessage();
}
?>